/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package system;

import Main.Parameters;
import java.io.File;

/**
 *
 * @author zem
 */
public class FileTaskRename {
      public  FileTaskRename(){
          String FileTask=""+Parameters.TaskFolder+Parameters.TaskName[Parameters.CurrentTaskNumber];
          if(!Parameters.TaskFailed){ //task done

                boolean rename = new File(FileTask).renameTo(new File(FileTask + Parameters.MoveDoneTaskExtension)); //renaming
            if (rename) {//if succesfull
                 Parameters.message_parameter[0] = Parameters.TaskName[Parameters.CurrentTaskNumber];
                 Parameters.message_parameter[1] = Parameters.TaskName[Parameters.CurrentTaskNumber]+Parameters.MoveDoneTaskExtension;
                 System.out.println(new Message("ev0004").message);
            } else {//if not
                 Parameters.message_parameter[0] = Parameters.TaskName[Parameters.CurrentTaskNumber];
                 Parameters.message_parameter[1] = Parameters.TaskName[Parameters.CurrentTaskNumber]+Parameters.MoveDoneTaskExtension;
                 System.out.println(new Message("er0003").message);
                }

            }else{
               boolean rename = new File(FileTask).renameTo(new File(FileTask + Parameters.MoveFailedTaskExtension)); //renaming
            if (rename) {//if succesfull
                 Parameters.message_parameter[0] = Parameters.TaskName[Parameters.CurrentTaskNumber];
                 Parameters.message_parameter[1] = Parameters.TaskName[Parameters.CurrentTaskNumber]+Parameters.MoveFailedTaskExtension;
                 System.out.println(new Message("ev0004").message);
            } else {//if not
                 Parameters.message_parameter[0] = Parameters.TaskName[Parameters.CurrentTaskNumber];
                 Parameters.message_parameter[1] = Parameters.TaskName[Parameters.CurrentTaskNumber]+Parameters.MoveFailedTaskExtension;
                 System.out.println(new Message("er0003").message);
                }
            }


        }
}
